<%@page contentType="text/html; charset=utf-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="primus" tagdir="/WEB-INF/tags" %>
<%@taglib prefix="primus_form" tagdir="/WEB-INF/tags/form" %>
<%@taglib prefix="primus_base" tagdir="/WEB-INF/tags/base" %>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<primus:page title="新增优惠券类型">
    <jsp:attribute name="script">
    </jsp:attribute>
    <jsp:body>
        <div class="breadcrumbs ace-save-state" id="breadcrumbs">
            <ul class="breadcrumb">
                <li>
                    <i class="ace-icon fa fa-home home-icon"></i>
                    <a href="welcome.do">
                        首页
                    </a>
                </li>
                <li>
                    运营管理
                </li>
                <li>
                    <a href="management/couponType.do">优惠券类型列表</a>
                </li>
                <li class="active">
                    新增
                </li>
            </ul>
            <a class="btn btn-xs btn-primary history-back">
                <i class="ace-icon fa fa-angle-left"></i>
                返回
            </a>
        </div>
        <div class="page-content">

            <c:if test="${not empty errMsg}">
                <div class="alert alert-info">
                    <button class="close" data-dismiss="alert">
                        <i class="ace-icon fa fa-times"></i>
                    </button>
                    ${errMsg}
                </div>
            </c:if>

            <primus_form:form action="management/couponType/save.do" id="coupon_type_form"
                              name="优惠券类型">
                <primus_form:text title="优惠券类型名" name="couponTypeName" placeholder="优惠券类型名"
                                  inputClass="required text col-xs-10 col-sm-5"/>

                <primus_base:row layout="single">
                    <label class="col-sm-2 control-label no-padding-right" for="couponScopeType">使用范围类型</label>
                    <div class="col-xs-10 col-sm-5">
                        <primus:couponScopeTypeSelect fieldName="couponScopeType"
                                                      fieldId="couponScopeType"
                                                      selectedField="${couponType.couponScopeType.name}"/>
                    </div>
                </primus_base:row>

                <primus_base:row layout="single">
                    <label class="col-sm-2 control-label no-padding-right">可使用的商品分类</label>
                    <div class="col-xs-10 col-sm-5">
                        <primus:couponTypeCategorySelect fieldName="categories" multi="true"
                                                         selectedFields="${couponType.categories}"/>
                    </div>
                </primus_base:row>

                <primus_base:row layout="single">
                    <label class="col-sm-2 control-label no-padding-right">可使用的商品品牌</label>
                    <div class="col-xs-10 col-sm-5">
                        <primus:couponTypeBrandSelect fieldName="brands" multi="true"
                                                         selectedFields="${couponType.brands}"/>
                    </div>
                </primus_base:row>

                <primus_base:row layout="single">
                    <label class="col-sm-2 control-label no-padding-right" for="include_product">可使用的优惠券商品</label>
                    <div class="col-sm-9">
                        <primus:couponTypeProductSelect fieldName="includeProducts"
                                                        fieldId="include_product"
                                                        fieldValues="${couponType.excludeProducts}"/>
                    </div>
                </primus_base:row>

                <primus_base:row layout="single">
                    <label class="col-sm-2 control-label no-padding-right" for="exclude_product">不能使用的优惠券商品</label>
                    <div class="col-sm-9">
                        <primus:couponTypeProductSelect fieldName="excludeProducts"
                                                        fieldId="exclude_product"
                                                        fieldValues="${couponType.excludeProducts}"/>
                    </div>
                </primus_base:row>

                <primus_form:text title="可使用的优惠券商家" name="vendors"/>

                <primus_base:row layout="single">
                    <label class="col-sm-2 control-label no-padding-right">优惠券限制使用类型</label>
                    <div class="col-sm-9">
                        <select name="couponLimitType">
                            <option value="ALL">不限制</option>
                            <option value="CATEGORY_LIMIT">品类限制</option>
                            <option value="BRAND_LIMIT">品牌限制</option>
                            <option value="PRODUCT_LIMIT">单品限制</option>
                        </select>
                    </div>
                </primus_base:row>

                <primus_base:row layout="single">
                    <label class="col-sm-2 control-label no-padding-right" for="coupon_type_desc">优惠券类型介绍</label>
                    <div class="col-xs-10 col-sm-5">
                        <textarea id="coupon_type_desc" name="couponTypeDesc"
                                  style="width: 100%"></textarea>
                    </div>
                </primus_base:row>

                <primus_form:number title="优惠券面值" name="faceValue"/>

                <primus_form:number title="优惠券使用金额门槛" name="couponLimitAmount"/>

                <primus_form:date title="优惠券可用开始时间" name="usableStartTime" placeholder="优惠券可用开始时间"/>

                <primus_form:date title="优惠券可用结束时间" name="usableEndTime" placeholder="优惠券可用结束时间"/>

                <primus_form:date title="优惠券领取开始时间" name="receivableStartTime"
                                  placeholder="优惠券领取开始时间"/>

                <primus_form:date title="优惠券领取结束时间" name="receivableEndTime"
                                  placeholder="优惠券领取结束时间"/>

                <primus_form:number title="优惠券发行数量" name="totalQuantity"/>

                <primus_form:upload title="优惠券图片" name="icon"/>

                <primus_base:row layout="single">
                    <label class="col-sm-2 control-label no-padding-right" for="coupon_type_remark">优惠券备注信息</label>
                    <div class="col-xs-10 col-sm-5">
                        <textarea id="coupon_type_remark" name="remark"
                                  style="width: 100%"></textarea>
                    </div>
                </primus_base:row>
            </primus_form:form>
        </div>
    </jsp:body>
</primus:page>
